﻿//======================================================================
//
//        Copyright (C) 2002-2008 S.Sams Lifexperience!
//        All rights reserved
//        FileName : Helper
//        Description :
//        Created by Sam Shen at 2008/8/1 23:18:25
//        http://lab.travelive.com.cn/
//        E-Mail: S.Sams@msn.com
//
//======================================================================

using System;

namespace S.Sams.GoogleMap
{
    /// <summary>
    /// 扩展工具类
    /// </summary>
    public static class Helper
    {
        /// <summary>
        /// 扩展 MapType 转为字符类型
        /// </summary>
        /// <param name="tm"></param>
        /// <returns></returns>
        public static string EnumParse(MapType tm)
        {
            switch (tm)
            {
                case MapType.Normal:
                default:
                    return "G_NORMAL_MAP";
                case MapType.Satellite:
                    return "G_SATELLITE_MAP";
                case MapType.Hybrid:
                    return "G_HYBRID_MAP";
                case MapType.G_PHYSICAL_MAP:
                    return "G_PHYSICAL_MAP";
            }
        }

        /// <summary>
        /// 扩展 MapControl 转为字符类型
        /// </summary>
        /// <param name="mc"></param>
        /// <returns></returns>
        public static string EnumParse(MapControl mc)
        {
            switch (mc)
            { 
                case MapControl.Normal:
                default:
                    return "GSmallMapControl";
                case MapControl.Mini:
                    return "GSmallZoomControl";
                case MapControl.Full:
                    return "GLargeMapControl";
            }
        }

        /// <summary>
        /// 标注点的系统默认图标
        /// </summary>
        /// <param name="selectIndex">索引号(从0开始)</param>
        /// <returns></returns>
        public static string LabelDefaultImage(int selectIndex)
        {
            if (selectIndex > 25) return "http://www.google.com/mapfiles/marker.png";
            string Chars = "ABCDEFGHIJKLMNOPQRSTUVWSYZ";
            return string.Format("http://www.google.com/mapfiles/marker{0}.png",Chars[selectIndex].ToString());
        }
    }
}
